package com.cheer.dto;

import com.cheer.enums.TitleEnum;
import com.cheer.vo.ApplicantPageVO;
import lombok.Data;
import lombok.experimental.Accessors;

@Data
@Accessors(chain = true)
public class ApplicantPageDTO {

    private Long applicantId;

    private String applicantName;

    private Integer title;

    private Integer registerTitle;

    private String phoneAccount;

    private String backupAccount;

    private String contactPerson;

    private Long standingBookId;

    private Integer starNum;

    public ApplicantPageVO build() {
        ApplicantPageVO applicantPageVO = new ApplicantPageVO();
        applicantPageVO.setApplicantId(applicantId);
        applicantPageVO.setApplicantName(applicantName);
        if (title == TitleEnum.NO.getType()) {
            applicantPageVO.setTitle(registerTitle);
            applicantPageVO.setAwarded(false);
        } else {
            applicantPageVO.setTitle(title);
            applicantPageVO.setAwarded(true);
        }
        applicantPageVO.setPhoneAccount(phoneAccount);
        applicantPageVO.setBackupAccount(backupAccount);
        applicantPageVO.setContactPerson(contactPerson);
        applicantPageVO.setStatus(standingBookId != null);
        applicantPageVO.setStarNum(starNum);
        return applicantPageVO;
    }

}
